package org.example.cake.service.impl;

import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import org.example.cake.mapper.ThemecakeMapper;
import org.example.cake.entity.Themecake;
import org.example.cake.service.ThemecakeService;

import java.util.List;

@Service
public class ThemecakeServiceImpl implements ThemecakeService{

    @Resource
    private ThemecakeMapper themecakeMapper;

    @Override
    public int deleteByPrimaryKey(Integer id) {
        return themecakeMapper.deleteByPrimaryKey(id);
    }

    @Override
    public int insert(Themecake record) {
        return themecakeMapper.insert(record);
    }

    @Override
    public int insertSelective(Themecake record) {
        return themecakeMapper.insertSelective(record);
    }

    @Override
    public Themecake selectByPrimaryKey(Integer id) {
        return themecakeMapper.selectByPrimaryKey(id);
    }

    @Override
    public int updateByPrimaryKeySelective(Themecake record) {
        return themecakeMapper.updateByPrimaryKeySelective(record);
    }

    @Override
    public int updateByPrimaryKey(Themecake record) {
        return themecakeMapper.updateByPrimaryKey(record);
    }

    /**
     * 查询所有主题蛋糕
     * @return 主题集合
     */
    @Override
    public List<Themecake> selectAllTheme() {
        return themecakeMapper.selectAllTheme();
    }


    /**
     * 根据id查询主题信息
     * @param id 主题id
     * @return 主题蛋糕对象
     */
    public Themecake selectById(@Param("id") Integer id){
        return themecakeMapper.selectById(id);
    }

}
